package sketch.experiment.complexdatastructure;

import fibheap.FibHeap;
import fibheap.Node;
import sketch.ounit.Observer;
import sketch.ounit.Values;
import sketch.specs.annotation.TestSketch;
import junit.framework.TestCase;

/**
 * The sketch for fib heap
 * */
public class Z_Sketch_FibHeap extends TestCase {
	@TestSketch
	public void testFibHeap() {
		FibHeap heap = new FibHeap();
		FibHeap heap2 = new FibHeap();
		Observer.observeExpr(heap.empty());
		assert heap.empty();
		Integer[] ints = Values.exhaust(1, 2, 3, 4);
		for(int i : ints) {
			heap.insert(i);
		}
		Observer.observeExpr(heap.empty());
		if(heap.min != null) {
		  System.out.println(heap.min().toString());
		  System.out.println(heap.min.toString(1, true));
			System.out.println(heap.min.toString(2, false));
		}
		Node n = heap.removeMin();
		heap2.insert(n);
		//heap.insert(n);
		heap2.decreaseKey(n, n.cost - 1);
		heap.deleteRandomNode();
		Observer.observeExpr(heap.size());
		FibHeap.union(heap, heap2);
		//while(h.size() > 0) {
//			h.removeMin();
//			h.removeMin();
//			h.removeMin();
		//}
	}
}
